<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Title</title>
    <script src="http://mockjs.com/dist/mock.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script>
      //ajax
      axios
        .request({
          method: "get",
          url: "https://cdn.liyanhui.com/data.json",
        })
        .then((res) => {
          console.log(res.data);
        });

      //mock拦截
      Mock.mock("https://cdn.liyanhui.com/data.json", {
        "list|5-10": [
          {
            "id|+1": 1,
            username: "@cname",
            email: "@email",
            gender: "@boolean",
            price: "@integer",
          },
        ],
      });
    </script>
  </head>
  <body></body>
</html>
